from django.contrib import admin
from .models import Project, ProjectAttachment

@admin.register(Project)
class ProjectAdmin(admin.ModelAdmin):
    list_display = ['name', 'status', 'crop_type', 'laboratory', 'created_at']
    list_filter = ['status', 'crop_type', 'laboratory', 'created_at']
    search_fields = ['name', 'description', 'location']
    readonly_fields = ['created_at', 'updated_at']

@admin.register(ProjectAttachment)
class ProjectAttachmentAdmin(admin.ModelAdmin):
    list_display = ['name', 'project', 'uploaded_by', 'uploaded_at']
    list_filter = ['uploaded_at', 'content_type']
    search_fields = ['name', 'project__name']
    readonly_fields = ['uploaded_at']
